interface Point {
  x: number;
  y: number
}

let p1: Point = {
  x: 100,
  y: 100
}


//可选属性
interface Point1 {
  x: number;
  y: number
  color?: string;
}

let p2: Point1 = {
  x: 100,
  y: 100,
  color: 'blue'
}
let p3: Point1 = {
  x: 100,
  y: 100,
}

//设置索引类的子类型
interface Point2 {
  [prop1: string]: string;
  [prop2: number]: string;
}

let p4: Point2 = {
  x: '100',
  1: '200',
}
p4.z = "222"
